﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:windows="clr-namespace:MixModes.Synergy.VisualFramework.Windows"
                    xmlns:behaviors="clr-namespace:MixModes.Synergy.VisualFramework.Behaviors"
                    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity">

    <!-- DockPane default style-->
    <Style TargetType="{x:Type windows:DockPane}">
        <Setter Property="Template"
                Value="{DynamicResource DockPaneTemplate}" />
        <Setter Property="Background"
                Value="{DynamicResource DockPaneBackgroundBrush}" />
        <Setter Property="BorderBrush"
                Value="{DynamicResource DockPaneBorderBrush}" />
        <Setter Property="CondencedDockPanelTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Border CornerRadius="0,0,2,2"
                            Background="{DynamicResource DockPaneBackgroundBrush}"
                            Margin="2"
                            TextBlock.Foreground="{DynamicResource DockPaneHeaderForegroundBrush}">
                        <DockPanel>
                            <Image Source="{Binding Icon}"
                                   Margin="2,0,2,0"
                                   DockPanel.Dock="Left" />

                            <ContentControl Content="{Binding Header}"
                                            Margin="0,0,2,0" />
                        </DockPanel>
                    </Border>
                </DataTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate>
                    <ContentControl Content="{TemplateBinding Content}" />
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="DockPointBorder"
           TargetType="{x:Type Border}">
        <Setter Property="BorderBrush"
                Value="Transparent" />
        <Setter Property="BorderThickness"
                Value="2" />
        <Setter Property="HorizontalAlignment"
                Value="Center" />
        <Setter Property="VerticalAlignment"
                Value="Center" />
        <Style.Triggers>
            <Trigger Property="IsMouseOver"
                     Value="True">
                <Setter Property="BorderBrush"
                        Value="Black" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="{x:Type windows:DocumentContainer}">        
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type windows:DocumentContainer}">
                    <ControlTemplate.Resources>
                        
                        <!-- Implicit GridSplitter Style -->
                        <Style TargetType="{x:Type GridSplitter}">
                            <Setter Property="Background"
                                    Value="Transparent" />
                        </Style>
                        
                    </ControlTemplate.Resources>
                    <Grid Background="Transparent">
                        
                        <!-- Document Content -->
                        <TabControl x:Name="PART_DOCUMENTS"
                                    ItemsSource="{TemplateBinding Documents}"
                                    Background="Transparent"
                                    SelectedIndex="0">
                            <TabControl.ItemContainerStyle>
                                <Style TargetType="TabItem">
                                    <Setter Property="Header"
                                            Value="{Binding Header}" />
                                    <Setter Property="Content"
                                            Value="{Binding Content}" />
                                    <Setter Property="Background"
                                            Value="{DynamicResource DockPaneBackgroundBrush}" />
                                    <Setter Property="Foreground"
                                            Value="{DynamicResource DockPaneHeaderForegroundBrush}" />                                    
                                    <Setter Property="Template"
                                            Value="{DynamicResource DockedContentTabItem}" />
                                </Style>
                            </TabControl.ItemContainerStyle>
                        </TabControl>
                        
                        <!-- Content Presenter -->
                        <ContentPresenter />
                        
                        <Grid x:Name="PART_DOCK_POINTS"
                              Visibility="Collapsed">
                            <Grid>
                                <Image Source="/MixModes.Synergy.Resources;component/Resources/DockHexagon.png" />
                                <Grid HorizontalAlignment="Center"
                                      VerticalAlignment="Center">
                                    <Grid.RowDefinitions>
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition />
                                        <ColumnDefinition />
                                        <ColumnDefinition />
                                    </Grid.ColumnDefinitions>
                                    <Border Style="{StaticResource DockPointBorder}"
                                            Grid.Row="0"
                                            Grid.Column="1">
                                        <i:Interaction.Behaviors>
                                            <behaviors:ContentDockBehavior DockPoint="Top" />
                                        </i:Interaction.Behaviors>
                                        <Image Source="/MixModes.Synergy.Resources;component/Resources/SplitTop.png" />
                                    </Border>
                                    <Border Style="{StaticResource DockPointBorder}"
                                            Grid.Row="1"
                                            Grid.Column="0">
                                        <i:Interaction.Behaviors>
                                            <behaviors:ContentDockBehavior DockPoint="Left" />
                                        </i:Interaction.Behaviors>
                                        <Image Source="/MixModes.Synergy.Resources;component/Resources/SplitLeft.png" />
                                    </Border>
                                    <Border Style="{StaticResource DockPointBorder}"
                                            Grid.Row="1"
                                            Grid.Column="2">
                                        <i:Interaction.Behaviors>
                                            <behaviors:ContentDockBehavior DockPoint="Right" />
                                        </i:Interaction.Behaviors>
                                        <Image Source="/MixModes.Synergy.Resources;component/Resources/SplitRight.png" />
                                    </Border>
                                    <Border Style="{StaticResource DockPointBorder}"
                                            Grid.Row="1"
                                            Grid.Column="1">
                                        <i:Interaction.Behaviors>
                                            <behaviors:ContentDockBehavior DockPoint="Content" />
                                        </i:Interaction.Behaviors>
                                        <Image Source="/MixModes.Synergy.Resources;component/Resources/DockCenter.png" />
                                    </Border>
                                    <Border Style="{StaticResource DockPointBorder}"
                                            Grid.Row="2"
                                            Grid.Column="1">
                                        <i:Interaction.Behaviors>
                                            <behaviors:ContentDockBehavior DockPoint="Bottom" />
                                        </i:Interaction.Behaviors>
                                        <Image Source="/MixModes.Synergy.Resources;component/Resources/SplitBottom.png" />
                                    </Border>
                                </Grid>
                            </Grid>
                        </Grid>

                        <!-- Illustrates future window docked position 
                 NOTE: IsHitTestVisible must be set to false for this dock pane -->
                        <DockPanel x:Name="PART_DOCK_ILLUSTRATION"
                                   LastChildFill="false"
                                   IsHitTestVisible="false" />

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>